<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!-- 内联样式-->

<input type="text" placeholder="" id="t1">
<input type="button" value="提交" onclick="f1()" >
<div><span>结</span></div>
<script>
    let random = parseInt(Math.random()*101);
    let count = 0;
  function  f1(){
      let t = document.querySelector("#t1");
      let d = document.querySelector("span");
      count++;
        if(isNaN(t.value)){
           return
        }
        if(t.value>random){
            d.innerText = "数字大了";
        }else if(random==t.value){
               d.innerText = "恭喜猜对了一共猜"+parseInt(count)+"次";
        }else {
            d.innerText = "数字小了";
        }

    }
</script>
</body>

</html>